﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FollowPlayer : MonoBehaviour
{
    public GameObject player;

    private void Update()
    {
        if (GameControl.instance.GameWin)
        {
            transform.position = new Vector3(player.transform.position.x, player.transform.position.y, transform.position.z);
        
        }
        else
        {
            transform.position = new Vector3(
                Mathf.Clamp(player.transform.position.x, 0, player.transform.position.x),
                transform.position.y,
                transform.position.z);
        }

    }




}
